$(f);

function f(){
    loadDataFromDouBan(1);

    $("#pagediv a").click(
        function(){
            //alert($(this).text());
            loadDataFromDouBan($(this).text());
        }
    );
}

function loadDataFromDouBan(p){
    $.ajax({
        url:"https://api.douban.com/v2/movie/top250?start="
        +((p-1)*10)+"&count=10",
        dataType:"jsonp",
        success:function(data){
            $(".movie_list").html("");
            var datas =  data.subjects;
            for(var i=0;i<datas.length;i++){
                var m = datas[i];
                var $newMovie = $("#temp").clone();
                $newMovie.removeAttr("id");
                $(".movie_list").append($newMovie);
                $newMovie.find("img").attr("src",m.images.large);
                $newMovie.find(".title").text(m.title);
                $newMovie.find(".score").text(m.rating.average);
            }
        }
    });
}